Skip to content

fix: Include the big segments status on evaluation reasons when a flag fails to evaluate - #258

Merged
keelerm84 merged 1 commit into
mainfrom
mk/SDK-3520/big-segments-error-status
Nov 10, 2026
Merged

keelerm84 merged 1 commit into
mainfrom
mk/SDK-3520/big-segments-error-status

Conversation

@keelerm84

@keelerm84 keelerm84 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Summary

When a flag rule queried a big segment and a later clause made the flag fail to evaluate (for example, a clause with no attribute), the error reason dropped the big segments status. The evaluator applied the status only to successful results. A failed evaluation now carries the status on its error reason. This matches the Go SDK, which applies the status whether or not evaluation fails.

Unexpected exceptions are unchanged. They escape Evaluator.evaluate() and are handled in InputValidatingEvaluator, where the evaluator state is not available. Catching them inside the evaluator would also change how those failures are logged, which event path records them, and the flag returned with the result. Go has no equivalent case, because a panic is not recovered there either.


Note

Overview
Fixes big segments status being dropped when flag evaluation ends in an error after a big-segment query already ran (e.g. a later malformed clause). The success path in Evaluator.evaluate() already merged state.bigSegmentsStatus onto the reason; the EvaluationException catch now does the same on EvalResult.error(...), aligning behavior with the Go SDK.

Adds EvaluatorBigSegmentTest cases where an earlier rule touches a big segment and a later rule is malformed, asserting BigSegmentsStatus (STALE or NOT_CONFIGURED) remains on the error reason.

Reviewed by Cursor Bugbot for commit 5f3d3f0. Bugbot is set up for automated code reviews on this repo. Configure here.

… evaluations

A malformed flag error that occurs after a big segment query no longer drops the big segments status from the reason.
@keelerm84
keelerm84 marked this pull request as ready for review November 9, 2026 18:16
@keelerm84
keelerm84 requested a review from a team as a code owner November 9, 2026 18:16
@keelerm84
keelerm84 merged commit ce08ae8 into main Nov 10, 2026
30 checks passed
@keelerm84
keelerm84 deleted the mk/SDK-3520/big-segments-error-status branch November 10, 2026 16:01
beekld pushed a commit that referenced this pull request Nov 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[7.18.0](launchdarkly-java-server-sdk-7.17.5...launchdarkly-java-server-sdk-7.18.0)
(2026-11-12)


### Features

* Apply RETRY to FDv2 synchronizer orchestration
([#252](#252))
([6a4aac5](6a4aac5))


### Bug Fixes

* Include the big segments status on evaluation reasons when a flag
fails to evaluate
([#258](#258))
([ce08ae8](ce08ae8))
* Make TestData valueForAll return its value when targeting is off
([#251](#251))
([db17ab9](db17ab9))
* Measure synchronizer deadlines with a monotonic clock
([#253](#253))
([3c7da2c](3c7da2c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> This **Release Please** PR cuts **launchdarkly-java-server-sdk
7.18.0** by bumping version metadata only:
`.release-please-manifest.json`, `lib/sdk/server/gradle.properties`, and
`Version.SDK_VERSION` move from **7.17.5** to **7.18.0**.
> 
> `CHANGELOG.md` gains a **7.18.0** section that records what ships in
this artifact (already merged elsewhere): **RETRY** on FDv2 synchronizer
orchestration; big-segments status on evaluation reasons when evaluation
fails; `TestData` `valueForAll` honoring its value when targeting is
off; synchronizer deadlines measured with a monotonic clock. This diff
does not contain those implementation changes.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
aa18674. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
kinyoklion added a commit that referenced this pull request Dec 3, 2026
… evaluations (#221)

<!-- TERMAG_PR_BODY_BEGIN -->
## Update, 2026-12-03

- `launchdarkly-java-sdk-common` 2.6.0 is released from `main` (#298).
Its source is the same as on `feat/overrides`, and the pin is unchanged.
- Verified against the Maven Central artifact: this head builds, with
the contract test service, and CI passes.

## Update, 2026-12-01

- Rebased onto `feat/overrides`, which has `main` merged into it again.
From `main` it gets the 7.19.0 to 7.19.2 releases, `java-sdk-internal`
1.14.0, and the FDv2 fix that leaves out an empty selector (#261). The
v3.2.0-alpha.21 contract tests check that fix, so CI failed three FDv2
streaming tests without it.
- Rebase conflict in `build.gradle`: `main`'s internal 1.14.0, with this
PR's common 2.6.0.
- `main` added a `clientSideAvailability` argument to the `FeatureFlag`
constructor (#275). The marked copy of a flag now passes it on, so an
override keeps the flag's client-side availability. The change is in the
first commit, and its test checks it.
- Verified with the v3.2.0-alpha.21 harness that CI runs, with `common`
2.6.0 and `internal` 1.15.0 published locally from `feat/overrides`:
  - every PR in the stack compiles, with Javadoc, at its own head;
- the server unit tests pass at the top (2348, with the 72 existing
skips);
- the full v3 contract tests pass at the top (6457 tests ran). That
includes the flag overrides suite and both flag listener suites.

## Update, 2026-11-13

- Rebased onto `feat/overrides`, which now includes #218 and #219 and
has `main` merged into it. From `main` it gets the 7.18.0 release, CI on
the latest v3 contract tests, flag change listener support in the
contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2
fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs
those fixes.
- Rebase conflicts with `main`, both resolved by keeping both sides:
- `Evaluator.java`: `main`'s #258 keeps the big segments status on an
error reason, and this PR marks that result as override-affected.
- `build.gradle`: `main`'s `jsr305` and internal 1.12.2, with this PR's
common 2.6.0.
- Verified at the top of the stack, with `common` and `internal`
published locally from `feat/overrides`:
  - every PR in the stack compiles, with Javadoc, at its own head;
  - the server unit tests pass (2285, with the 72 existing skips);
- the full v3 contract tests pass (6321 tests). That includes the flag
overrides suite, with the deleted-entry tests of
launchdarkly/sdk-test-harness#599, and both flag listener suites.

## Summary

The OVERRIDE specification requires an evaluation to be marked as
override-affected when any definition it read carried the override
marker: the evaluated flag, a prerequisite at any depth, or a segment
consulted during matching, whether or not the segment matched. The
marking propagates upward only: a prerequisite's own record reflects
only the definitions that its own subtree read, while the evaluation
that requested it accumulates the result. An evaluation that fails is
still marked when it read a marked definition, and a requested-type
mismatch keeps the marking on its error reason, as does the WRONG_TYPE
error that `migrationVariation` returns for an unrecognized stage.

- `DataModel.FeatureFlag` and `DataModel.Segment` carry a transient
`isOverride` marker. It is never serialized and never read from JSON.
`markedAsOverride()` returns a shallow copy with the marker set, sharing
nested collections and preprocessing with the source and never modifying
it. The override layer will use it in the next change.
- The evaluator tracks the marking per evaluation scope. The scope
starts from its own flag's marker, each segment read can set it, and the
value is saved, reset to the prerequisite's own marker, and restored
around every prerequisite evaluation. Each result and each prerequisite
record carries the marking on its reason.
- `EvalResult.isOverrideAffected()` reads the reason's indicator, and
`withOverrideAffected(boolean)` returns a copy so that the shared
precomputed results are never mutated.
- An evaluation that throws returns an `EXCEPTION` result marked with
the evaluated flag's own marker, because that definition was read before
the failure.
- The server SDK now depends on launchdarkly-java-sdk-common 2.6.0,
which adds `EvaluationReason.isOverrideAffected()` and the
`overrideAffected` JSON property (written only when true).

Flag overrides are currently experimental and subject to change.

The existing file data source keeps its current behavior; this change
does not touch its code paths.

[SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246)


[SDK-3246]:
https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> Adds **experimental flag-override tracking** so evaluations can report
when they were influenced by local override definitions rather than
LaunchDarkly data.
> 
> **FeatureFlag** and **Segment** gain a transient `isOverride` marker
(never serialized) and `markedAsOverride()` shallow copies for the
override layer to use. The **Evaluator** tracks whether the current
scope read any marked flag, prerequisite subtree, or segment (match or
not), propagating upward while keeping each prerequisite record scoped
to its own subtree. **`EvalResult`** exposes `isOverrideAffected()` and
`withOverrideAffected()` via `EvaluationReason` so shared precomputed
results stay immutable.
> 
> **InputValidatingEvaluator**, **MigrationStageEnforcingEvaluator**,
and `allFlagsState` preserve override marking across type errors,
exceptions, and malformed evaluations. Dependency
**`launchdarkly-java-sdk-common`** is bumped to **2.6.0** for
`EvaluationReason.isOverrideAffected()`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
a2a5c8e. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- TERMAG_PR_BODY_END -->

<!-- termag: box=i-0575d1c54853058d7 project=java-core -->
<sub>Opened from termag</sub>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants